package com.dxl.config;

import com.baomidou.mybatisplus.extension.plugins.OptimisticLockerInterceptor;
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.transaction.annotation.EnableTransactionManagement;

/**
 * @author dxl
 * @date 2020/12/12 16:06
 */
//开启事务
@EnableTransactionManagement
@Configuration
public class MybatisPlusConfig {
    //分页插件
    @Bean
    public PaginationInterceptor paginationInterceptor() {
        return new PaginationInterceptor();
    }
    //注册乐观锁插件
    @Bean
    public OptimisticLockerInterceptor optimisticLockerInterceptor() {
        return new OptimisticLockerInterceptor();
    }
//    /**
//     * sql执行效率插件
//     */
//    @Bean
//    @Profile({"dev","test"})
//    public PerformanceMonitorInterceptor performanceMonitorInterceptor(){
//        return new PerformanceMonitorInterceptor();
//    }
}
